package com.dlss.scjp;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.view.MenuItem;

public class OptionsMenu 
{
	public static boolean onOptionsItemSelected(MenuItem item, Activity activity) {

		AlertDialog alertDialog = null;
		switch (item.getItemId()) {
		case R.id.help:   

			alertDialog = new AlertDialog.Builder(activity).create();
			alertDialog.setTitle("Help");
			alertDialog.setMessage("Asks 10 questions at a time and gives the score at the end\n\n" +
					"Only once you have answered all the questions can you be asked the same question again. Only one option is ever correct. " +
					"\nEvery time a question is answered incorrectly the answer is given, press the next button " +
					"to move onto the next question");

			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {}
			});

			alertDialog.show();

			return true;
		case R.id.about:
			
			alertDialog = new AlertDialog.Builder(activity).create();
			alertDialog.setTitle("About");
			alertDialog.setMessage("Version: "+activity.getResources().getText(R.string.version) + "\n\n" +
					"Author: David Lang\n" +
					"Email: davielang@gmail.com\n\n" +
					"Questions: " +  activity.getResources().getText(R.string.no_of_questions));


			alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {}
			});

			alertDialog.show();

		}

		return true;
	}
}
